package com.nervenets.web.controller.building;

import com.nervenets.web.enumeration.CheckStatus;
import com.nervenets.web.enumeration.Role;
import com.nervenets.web.hibernate.domain.Building;
import com.nervenets.web.hibernate.domain.HouseType;
import com.nervenets.web.hibernate.domain.Manager;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class BuildingListDto implements Serializable {
    private long id;
    private String name;
    private String cover;
    private List<String> tags;
    private String price;
    private String totalPrice;
    private List<HouseType> houseTypes;
    private String address;
    private long managerId;
    private String managerMobile;
    private String managerName;
    private Role managerRole;
    private String contactName;
    private String contactMobile;
    private String bankContactName;
    private String bankContactMobile;
    private boolean dating;
    private long sincer;
    private CheckStatus checkStatus;
    private String remark;
    private boolean onSale;

    public BuildingListDto(Building building) {
        this.id = building.getId();
        this.name = building.getName();
        this.cover = building.getCover();
        this.tags = building.getTags();
        this.price = building.getPrice();
        this.totalPrice = building.getTotalPrice();
        this.houseTypes = building.getHouseTypes();
        this.address = building.getAddress();
        final Manager manager = building.getManager();
        this.managerId = manager.getId();
        this.managerMobile = manager.getMobile();
        this.managerName = manager.getName();
        this.managerRole = manager.getRole();
        this.contactName = manager.getContactName();
        this.contactMobile = manager.getContactMobile();
        this.bankContactName = manager.getBankContactName();
        this.bankContactMobile = manager.getBankContactMobile();
        this.dating = building.isDating();
        this.sincer = building.getSincer();
        this.checkStatus = building.getCheckStatus();
        this.remark = building.getRemark();
        this.onSale = building.isOnSale();
    }
}
